<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<meta name="viewport"
	content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description"
	content="碳氢知识平台由碳三氢二个人创建，属于免费开放的知识浏览平台。该平台主要用于学习Java相关的知识。">
<meta name="keywords"
	content="碳氢知识,碳三氢二,tansanqinger,tanqingzhishi,C3H2,c3h2,碳十八氢十二,碳三,tansan,C18H12">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="spm_prefix" content="333.851">
<link rel="icon" href="/img/index.ico" />
<link rel="shortcut icon" href="/img/index.ico" />
<meta charset="UTF-8" name="viewport"
	content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="/layui/css/layui.css">
<link rel="stylesheet" href="https://demo.easyweb.vip/iframe/assets/module/admin.css?v=318"/>
<script src="/layui/layui.js"></script>

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.0/dist/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.0/dist/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.js"></script>
<script type="text/javascript" src="https://demo.easyweb.vip/iframe/assets/js/common.js?v=318"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/sockjs-client/1.4.0/sockjs.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/stomp.js/2.3.3/stomp.min.js"></script>
<title>碳氢知识</title>
<style type="text/css">
*{margin:0px auto;padding:0px auto;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}
body,html{background-color:#F5F5F5; width: 100%; height: 100%;min-width: 1280px;min-height: 800px;-webkit-box-align: center;-webkit-align-items: center;-ms-flex-align: center;align-items: center;-webkit-box-pack: center;-webkit-justify-content: center;-ms-flex-pack: center;justify-content: center;}
.paddingRightLeft0{padding-right:0px;padding-left: 0px;}
.col, .col-1, .col-10, .col-11, .col-12, .col-2, .col-3, .col-4, .col-5, .col-6, .col-7, .col-8, .col-9, .col-auto, .col-lg, .col-lg-1, .col-lg-10, .col-lg-11, .col-lg-12, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-auto, .col-md, .col-md-1, .col-md-10, .col-md-11, .col-md-12, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-auto, .col-sm, .col-sm-1, .col-sm-10, .col-sm-11, .col-sm-12, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-auto, .col-xl, .col-xl-1, .col-xl-10, .col-xl-11, .col-xl-12, .col-xl-2, .col-xl-3, .col-xl-4, .col-xl-5, .col-xl-6, .col-xl-7, .col-xl-8, .col-xl-9, .col-xl-auto{padding-left: 0px;padding-top: 0px;}
.pageTopSize{width: 100%;height: 90%;margin-top: 0px;margin-left: 0px;margin-bottom: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;}
.pageBottomSize{width: 100%;height: 10%;margin-top: 0px;margin-left: 0px;margin-bottom: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;}
.fixed{position: fixed;left: 0px;bottom: 0px;width: 100%;height: 54px;z-index: 9999;background-color:	#F5F5F5;}
.fixedBottom{left: 0px;bottom: 0px;width: 100%;height: 54px;}
a:link{color: #000;}
a:visited{color: #000;}
a:hover {text-decoration: none;}
.viridian{background-color: #3F7F62;}
.turquoise{background-color: #40E0D0;}
.layui-nav .layui-nav-more{border-top-color:#000000;margin-top: -0px;}
.layui-nav .layui-nav-mored{border-color: transparent transparent #000000;margin-top: -5px;}
.img-group {
  position: relative;
  display: inline-block;
}
        
.img-tip {
  position: absolute;
  bottom: 1;
  background: #FAFAD2;
  color: #000;
  opacity: 0.6;
  z-index:9999;
  display: none;
}
        
.img-group:hover .img-tip {
  display: block;
  width: 100%;
  width:70px;
  text-align: center;
}
.layui-layedit{
	border-width: 0px;
    border-style: none;
    border-radius: 0px;
}
.btn:focus,.btn:active:focus,.btn.active:focus,.btn.focus,.btn:active.focus,.btn.active.focus {outline: none;box-shadow:none;}
#chatMessage::-webkit-scrollbar {
  width: 4px;
  display: none;
}
#chatMessage:hover::-webkit-scrollbar {
  width: 4px;
  display: block;
}
#containerDiv3::-webkit-scrollbar {
  width: 4px;
  display: none;
}
#containerDiv3:hover::-webkit-scrollbar {
  width: 4px;
  display: block;
}
.span-line:hover{
  text-decoration:underline;
}
.layui-table tbody tr:hover, .layui-table thead tr{
    background-color: transparent;
}
.tr-line:hover{
	background-color: #595959;
}
</style>
</head>
<body>
<div class="container">
  <div class="row">
	<div style="text-align: center; height:70px; line-height:70px;">
	   <img alt="" src="/img/logo_interface.png" style="height: 40px; display: inline-block; vertical-align: middle;padding:0 1.75rem" />
	</div>
    <div class="col-6" style="line-height: 70px; font-size: 30px;">
    	<ul class="layui-nav" lay-filter="" style="background-color: #F5F5F5; ">
		  <span th:each="menus:${menuAll}">
			  <li class="layui-nav-item" th:each="menu:${menus}" th:if="${menuStat.first}">
			  	<a th:href="${menu.hmenuUrl}" style="font-size: 30px; color: #000000;" th:if="${menu.hmenuOrder}==1">[[${menu.hmenuName}]]</a>
			    <dl class="layui-nav-child" th:if="${menuStat.last}==false and ${menuStat.first}"> <!-- 二级菜单 -->
			      <dd th:each="menu:${menus}"><a th:if="${menu.hmenuOrder}!=1" th:href="${menu.hmenuUrl}" style="height: 30px; line-height: 26px;">[[${menu.hmenuName}]]</a></dd>
			    </dl>
			  </li>
		  </span>
	 </ul>
    </div>
    <div class="col" style="text-align: right; line-height: 70px; font-size: 16px;word-spacing: 16px;">
		<svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-search" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
		  <path fill-rule="evenodd" d="M10.442 10.442a1 1 0 0 1 1.415 0l3.85 3.85a1 1 0 0 1-1.414 1.415l-3.85-3.85a1 1 0 0 1 0-1.415z"/>
		  <path fill-rule="evenodd" d="M6.5 12a5.5 5.5 0 1 0 0-11 5.5 5.5 0 0 0 0 11zM13 6.5a6.5 6.5 0 1 1-13 0 6.5 6.5 0 0 1 13 0z"/>
		</svg>
		<span onclick="showImg()">手机APP</span>
		<span th:if="${user}==null">
			<a href="/login">登陆</a>
			<a href="/login/register">
				<button type="button" class="btn btn-primary">注册</button>
			</a>
		</span>
		<span th:if="${user}!=null">
			<span class="btn" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
				<img th:src="@{${user.img}}" style="width: 40px; height: 40px; border-radius: 50%;" alt="头像">
			</span>
			<div class="dropdown-menu">
				<a class="dropdown-item" th:if="${user.jurisdiction}==0" href="/account/user/index"
					style="height: 30px; line-height: 30px;" target="_blank">账号中心</a>
				<a class="dropdown-item" href="/account/user/message" style="height: 30px; line-height: 30px;" target="_blank">消息中心</a>
				<a class="dropdown-item" href="/" style="height: 30px; line-height: 30px;">退出登陆</a>
			</div>
		</span>
    </div>
  </div>
</div>


<div class="container">
	<div class="row" id="containerDiv">
		<div class="col-sm-3" style="padding-right: 0px; border: solid  #e2e2e2 2px; border-radius: 5px; background-color: #fff;" >
		<div>
			<div class="layui-col-md2" style="border-right: solid #e2e2e2 1px;" id="containerDiv2">
				<div style="text-align: center; margin-top: 20px; background-color: #fff;">
					<img th:src="@{${user.img}}" style="width: 30px; height: 30px; border-radius: 50%;" alt="头像" th:attr="onclick='submitHeadPortrait('+${user.id}+')'"><br><br>
				<div class="img-group">
					<a href="/exchange/index"><i class="layui-icon layui-icon-reply-fill" style="font-size: 30px; color: #000;"></i></a>
					<div class="img-tip" style="width: 35px;">信息</div>
				</div><br><br>
				<div class="img-group">
					<a href="/exchange/linkman"><i class="layui-icon layui-icon-group" style="font-size: 30px; color: #000;"></i></a>
					<div class="img-tip" style="width: 55px;">联系人</div>
				</div><br><br>
				<div class="img-group">
					<a href="/exchange/file"><i class="layui-icon layui-icon-upload" style="font-size: 30px;color: #1E90FF;"></i></a>
					<div class="img-tip" style="width: 70px;">文件中心</div>
				</div>
				</div>
			</div>
		    <div class="layui-col-md10" >
		    	<div class="layui-inline" style="margin: 5px;">
					<div class="layui-input-inline" style="padding-bottom: 5px;">
						<input type="tel" class="layui-input" style="height: 20px; width: 190px; line-height: 10px; font-size: 12px;">
					</div>&nbsp;&nbsp;
					<div class="img-group">
					<i class="layui-icon layui-icon-addition" style="font-size: 20px; color: #000;"></i> 
					<div class="img-tip">添加群聊</div>
				</div>
				</div>
		      <div class="layui-card" style="overflow:auto" id="containerDiv3">
		        <table class="layui-table" style="padding-top: 0px;margin-top: 0px;" id="folderMessageTable">
				  <tbody>
				    <tr>
				      <td style="font-size: 20px; background-color: #D3D3D3;" onclick="accountSubmit(this,0);" id="folderTd0">
				      	<b>默认文件夹</b>
				      </td>
				    </tr>
				    <tr th:if="${fileNamees}!=null" th:each="fileName:${fileNamees}">
				    	<td style="font-size: 20px;" th:attr="onclick='accountSubmit(this,'+${fileName.fid}+');'" th:id="'folderTd'+${fileName.fid}">
				    		<b>[[${fileName.fname}]]</b>
				    	</td>
				    </tr>
				  </tbody>
				</table>
		      </div>
		    </div>
		</div>
	    </div>
	    <div class="col-sm-9" style="background-color: #fff; padding-right: 0px;">
	    	<div class="layui-col-sm12" style="border-bottom: solid #e2e2e2 2px; line-height:40px; height:44px; padding-left: 10px;">
	    		<div class="img-group" style=" margin-bottom: 5px;">
					<button type="button" class="layui-btn layui-btn-xs layui-bg-blue" id="test3"><i class="layui-icon"></i>上传文件</button>
				</div>
	    		<div class="img-group" style="padding-left: 30px;">
	    			<button type="button" class="layui-btn layui-btn-xs" id="newFile" onclick="newFile();">新建文件夹</button>
				</div>
	    	</div>
		    <div class="layui-col-sm12">
		    	<div class="layui-col-sm10" style="padding: 10px; height: 50px; line-height: 30px;" >
		    		<span><span id="thisFileName">默认文件夹</span><i class="" id="thisNewFileName" onclick="thisNewFileName();"></i>
		    			（已用：<span id="thisFileSize">[[${fileMessageesSize}]]</span>）</span>
		    	</div>
		    	<div class="layui-col-sm2" style="padding: 10px; height: 50px; line-height: 30px; text-align: right;">
		    		<a style="color: red; font-size: 14px;" id="thisDeleteFile" onclick="thisDeleteFile();"></a>
		    	</div>
		    	<div id="fileTableMessage">
					
				</div>
		    </div>
	    </div>
	</div>
</div>
<a href="/exchange/downloadFile" download="" id="downloadFile"></a>
<script src="/js/jquery.js"></script>
<script src="/js/socket/socket.io.js"></script>     

<script type="text/javascript">
let fileMessageesSizeNumber = 0;
let fid = 0;
$("#folderTd0").click();
function accountSubmit(thiss,id){
	let params = {};
	params.fid = id;
	$.ajax({
		url : '/exchange/selectFileMessageAll',
		type : 'post',
		data : params,
		dataType : 'json',
		success : function(data) {
			var data2 = eval(data);
			let size = 0 ;
			let dataMessage = '<table class="layui-table" style="padding-top: 0px;margin-top: 0px;" id="fileTable">'
			  +'<tbody>'
			  +  '<tr class="tr-line">'
			  +    '<th> 文件名 </th>'
			  +    '<th width="170"> 上传时间 </th>'
			  +    '<th width="140"> 文件大小 </th>'
			  +    '<th width="280"> 文件操作 </th>'
			  +  '</tr>';
			if (data=='') {
				dataMessage += '<tr><td colspan="4" style="text-align: center;">暂无任何文件</td></tr>';
			} else {
				
				for(let i in data2){
					size += data2[i].fsize;
					dataMessage += '<tr id="fileMessageTR'+data2[i].fid+'">'
				      + '<td id="fileMessageFname'+data2[i].fuid+'"> '+data2[i].fname+'</td>'
				      + '<td>'+data2[i].fdate+'</td>';
				      if(data2[i].fsize<1024){
				    	  dataMessage += '<td>1KB</td>'; 
				      } else if(data2[i].fsize<1024*1024){
				    	  dataMessage += '<td>'+parseInt(data2[i].fsize/1024)+'KB</td>' ;
				      } else if(data2[i].fsize<1024*1024){
				    	  dataMessage += '<td>'+parseInt(data2[i].fsize/1024/1024)+'MB</td>' ;
				      } else if(data2[i].fsize<1024*1024){
				    	  dataMessage += '<td>'+parseInt(data2[i].fsize/1024/1024)+'GB</td>' ;
				      }
				      dataMessage += '<td>'
				      +	'<span class="span-line" style="margin-right: 23px;" onclick="downloadFile(`'+data2[i].fuid+'`,`'+data2[i].fname+'`);">下载</span>'
				      +	'<span class="span-line" style="margin-right: 25px;" onclick="rechristenFile(`'+data2[i].fuid+'`,this);">重命名</span>'
				      +	'<span class="span-line" style="margin-right: 21px;" onclick="deleteFile(`'+data2[i].fuid+'`,this,'+data2[i].fsize+');">删除</span>' 
				      +	'<span class="span-line" onclick="moveFile(`'+data2[i].fuid+'`,this,'+data2[i].fsize+');">移动位置</span>'
				      +'</td>'
				      +'</tr>';
		        }
			}
			dataMessage += '</tbody></table>';
			if(size==0){
				$("#thisFileSize").html('0KB');
			} else if(size<1024){
				$("#thisFileSize").html('1KB');
			} else if(size<1024*1024){
				$("#thisFileSize").html(parseInt(size/1024)+'KB');
			} else if(size<1024*1024*1024){
				$("#thisFileSize").html(parseInt(size/1024/1024)+'MB');
			} else {
				$("#thisFileSize").html(parseInt(size/1024/1024/1024)+'GB');
			}
			fileMessageesSizeNumber = size;
			$("#fileTableMessage").html(dataMessage);
		}
	});
	$("#folderTd"+fid).css("background-color","#fff");
	fid = id;
	$(thiss).css("background-color","#D3D3D3");
	$("#thisFileName").html($(thiss).text());
	if(fid!=0){
		$("#thisDeleteFile").html("删除")
		$("#thisNewFileName").attr("class","layui-icon layui-icon-edit");
	} else {
		$("#thisDeleteFile").html("");
		$("#thisNewFileName").attr("class","");
	}
}
//修改文件夹名称
function thisNewFileName(){
	parent.layui.admin.prompt({
		title : '请输入新文件夹名：',
		formType : 0
	}, function(value, index, elem) {
		parent.layer.close(index);
		let params = {};
		params.id = fid;
		params.name = value;
		$.ajax({
			url : '/exchange/modificationFileName',
			type : 'post',
			data : params,
			dataType : 'json',
			success : function(data) {
				if (data.code == 0) {
					layer.msg(data.msg, {icon : 1 });
					$("#thisFileName").html(value);
					$("#folderTd"+fid).html('<b>'+value+'<b>');
				} else {
					layer.msg(data.msg, {icon : 2 });
				}
			}
		});
	});
}
//删除文件夹
function thisDeleteFile(){
	let params = {};
	params.id = fid;
	$.ajax( {
        url : '/exchange/deleteFileName', 
        type : 'post',
        data: params,
        dataType : 'json',
        success: function(data){
        	if(data.code==0){
        		layer.msg(data.msg,{icon: 1});
        		setTimeout(function(){
	        		 location.reload();
				 },1500);
        	} else {
        		layer.msg(data.msg,{icon: 2});
        	}
        }
	});
}
//上传文件
layui.use('upload', function(){
	var $ = layui.jquery
	,upload = layui.upload;
	upload.render({
	  elem: '#test3'
	  ,url: '/exchange/uploadfile?fid='+fid 
	  ,accept: 'file' //普通文件
	  ,done: function(res){
		  if(res.code==0){
			layer.msg(res.msg,{icon: 1});
			    //console.log(res);
		    var a = document.getElementById("fileTable"); //定位在tbody 拿出值  
		    var tr = document.createElement("tr");   //创建一个行<tr>  
		    
		    tr.innerHTML = '<td th:id="fileMessageFname'+res.fuid+'">'+res.fname+'</td>'
		      +'<td>'+res.date+'</td>';
		      if(res.fsize<1024){
		    	  tr.innerHTML += '<td>1KB</td>'; 
		      } else if(res.fsize<1024*1024){
		    	  tr.innerHTML += '<td>'+parseInt(res.fsize/1024)+'KB</td>' ;
		      } else if(res.fsize<1024*1024){
		    	  tr.innerHTML += '<td>'+parseInt(res.fsize/1024/1024)+'MB</td>' ;
		      } else if(res.fsize<1024*1024){
		    	  tr.innerHTML += '<td>'+parseInt(res.fsize/1024/1024)+'GB</td>' ;
		      }
		      tr.innerHTML += '<td>'
		      +	'<span class="span-line" style="margin-right: 23px;" onclick="downloadFile('+res.fuid+',`'+res.fname+'`);">下载</span>'
		      +	'<span class="span-line" style="margin-right: 25px;" onclick="rechristenFile('+res.fuid+',this);">重命名</span>'
		      +	'<span class="span-line" style="margin-right: 21px;" onclick="deleteFile('+res.fuid+',this,'+res.fsize+');">删除</span> '
		      +	'<span class="span-line" onclick="moveFile('+res.fuid+',this,'+res.fsize+');">移动位置</span>'
		      +'</td>';
		    a.appendChild(tr);
		    fileMessageesSizeNumber += res.fsize;
    		if(fileMessageesSizeNumber==0){
				$("#thisFileSize").html('0KB');
			} else if(fileMessageesSizeNumber<1024){
				$("#thisFileSize").html('1KB');
			} else if(fileMessageesSizeNumber<1024*1024){
				$("#thisFileSize").html(parseInt(fileMessageesSizeNumber/1024)+'KB');
			} else if(fileMessageesSizeNumber<1024*1024*1024){
				$("#thisFileSize").html(parseInt(fileMessageesSizeNumber/1024/1024)+'MB');
			} else {
				$("#thisFileSize").html(parseInt(fileMessageesSizeNumber/1024/1024/1024)+'GB');
			}
		  } else {
			  layer.msg(res.msg,{icon: 2});
		  }
	  }
	});
});
//新建文件夹
function newFile(){
	parent.layui.admin.prompt({
		title : '请为文件夹命名',
		formType : 0
	}, function(value, index, elem) {
		parent.layer.close(index);
		let params = {};
		params.name = value;
		$.ajax({
			url : '/exchange/newFile',
			type : 'post',
			data : params,
			dataType : 'json',
			success : function(data) {
				if (data.code == 0) {
					layer.msg(data.msg, {icon : 1 });
					var a = document.getElementById("folderMessageTable"); //定位在tbody 拿出值  
				    var tr = document.createElement("tr");   //创建一个行<tr>  
				    tr.innerHTML = '<td style="font-size: 20px;" onclick="accountSubmit(this,'+data.fid+');" id="folderTd'+data.fid+'"><b>'+data.fname+'</b></td>';  
				    a.appendChild(tr);
					
				} else {
					layer.msg(data.msg, {icon : 2 });
				}
			}
		});
	});
}

//移动文件
function moveFile(id,obj,size){
	let params = {};
	params.id = id;
	$.ajax( {
        url : '/exchange/selectFilenameAll', 
        type : 'post',
        data: params,
        dataType : 'json',
        success: function(data){
        	if(data==''){
        		layer.msg('无其他文件夹可以选',{icon: 2});
        	} else {
        		var data2 = eval(data);
    			let dataMessage = '<div class="layui-form-item" >' +
	            	'<select name="range" id="range" style="width:300px; height:40px; font-size:20px;" lay-filter="range">' +
	            	'<option value="0">默认文件夹</option>';
    	        for(var i in data2){
    	        	dataMessage += '<option value="'+data2[i].fid+'">'+data2[i].fname+'</option>';
    	        }
	    	        dataMessage += '</select></div>';
        		layer.open({
        	        title: '选择新的文件夹'
        	        , btn: ['确定']
        	        , content: dataMessage
        	        , yes: function (index) {
        	        	let params = {};
        	        	params.id = id;
        	        	params.fid = $("#range").val();
        	        	$.ajax( {
        	                url : '/exchange/modificationFileToNewFile', 
        	                type : 'post',
        	                data: params,
        	                dataType : 'json',
        	                success: function(data){
        	                	if(data.code==0){
        	                		layer.msg(data.msg,{icon: 1});
        	                		var tr=obj.parentNode.parentNode;
        	                		var tbody=tr.parentNode;
        	                		tbody.removeChild(tr);
        	                		if(tbody.rows.length==1) {
        	                			var a = document.getElementById("fileTable");
        	                		    var tr = document.createElement("tr"); 
        	                		    tr.innerHTML = '<td colspan="4" style="text-align: center;">暂无任何文件</td>';  
        	                		    a.appendChild(tr);
        	                		}
        	                		fileMessageesSizeNumber -= size;
        	                		if(fileMessageesSizeNumber==0){
        	            				$("#thisFileSize").html('0KB');
        	            			} else if(fileMessageesSizeNumber<1024){
        	            				$("#thisFileSize").html('1KB');
        	            			} else if(fileMessageesSizeNumber<1024*1024){
        	            				$("#thisFileSize").html(parseInt(fileMessageesSizeNumber/1024)+'KB');
        	            			} else if(fileMessageesSizeNumber<1024*1024*1024){
        	            				$("#thisFileSize").html(parseInt(fileMessageesSizeNumber/1024/1024)+'MB');
        	            			} else {
        	            				$("#thisFileSize").html(parseInt(fileMessageesSizeNumber/1024/1024/1024)+'GB');
        	            			}
        	                	} else {
        	                		layer.msg(data.msg,{icon: 2});
        	                	}
        	                }
        	        	});
        	            layer.close(index)
        	        }
        	    });
        	}
        }
	});
}
//删除文件
function deleteFile(id,obj,size){
	let params = {};
	params.id = id;
	$.ajax( {
        url : '/exchange/deleteFileMessage', 
        type : 'post',
        data: params,
        dataType : 'json',
        success: function(data){
        	if(data.code==0){
        		layer.msg(data.msg,{icon: 1});
        		var tr=obj.parentNode.parentNode;
        		var tbody=tr.parentNode;
        		tbody.removeChild(tr);
        		if(tbody.rows.length==1) {
        			var a = document.getElementById("fileTable");
        		    var tr = document.createElement("tr"); 
        		    tr.innerHTML = '<td colspan="4" style="text-align: center;">暂无任何文件</td>';  
        		    a.appendChild(tr);
        		}
        		fileMessageesSizeNumber -= size;
        		if(fileMessageesSizeNumber==0){
    				$("#thisFileSize").html('0KB');
    			} else if(fileMessageesSizeNumber<1024){
    				$("#thisFileSize").html('1KB');
    			} else if(fileMessageesSizeNumber<1024*1024){
    				$("#thisFileSize").html(parseInt(fileMessageesSizeNumber/1024)+'KB');
    			} else if(fileMessageesSizeNumber<1024*1024*1024){
    				$("#thisFileSize").html(parseInt(fileMessageesSizeNumber/1024/1024)+'MB');
    			} else {
    				$("#thisFileSize").html(parseInt(fileMessageesSizeNumber/1024/1024/1024)+'GB');
    			}
        	} else {
        		layer.msg(data.msg,{icon: 2});
        	}
        }
	});
}
//重命名文件名
function rechristenFile(id){
	parent.layui.admin.prompt({
		title : '请输入新文件名：',
		formType : 0
	}, function(value, index, elem) {
		parent.layer.close(index);
		let params = {};
		params.id = id;
		params.name = value;
		$.ajax({
			url : '/exchange/modificationFileMessage',
			type : 'post',
			data : params,
			dataType : 'json',
			success : function(data) {
				if (data.code == 0) {
					layer.msg(data.msg, {icon : 1 });
					$("#fileMessageFname"+id).html(value);
				} else {
					layer.msg(data.msg, {icon : 2 });
				}
			}
		});
	});
}
//下载文件
function downloadFile(id,name){
	$("#downloadFile").attr("href",$("#downloadFile").attr("href")+"?id="+id);
	$("#downloadFile").attr("download",name);
	$("#downloadFile")[0].click();
}
function pageHightSet3(){
	let height = window.innerHeight;
	$("#containerDiv").css("height",height-91+"px");
	$("#containerDiv2").css("height",height-95+"px");
	$("#containerDiv3").css("height",height-139+"px");
}
</script>


             
<script type="text/javascript">
$(function(){
	let height = window.innerHeight;
	$("#containerDiv").css("height",height-91+"px");
	$("#containerDiv2").css("height",height-95+"px");
	$("#containerDiv3").css("height",height-139+"px");
});
</script>
<a href="/message?name=" id="messageSub"></a>
</body>
<script>
var layedit;
var editIndex;
layui.use(['layer', 'form', 'xmSelect', 'layedit'], function () {
    var $ = layui.jquery;
    var layer = layui.layer;
    var form = layui.form;
    var xmSelect = layui.xmSelect;
    layedit = layui.layedit;
    editIndex = layedit.build('eQuestionContentEdt', {tool: ['face'],height: 106});
});
var sname = '';
const socket = io.connect('http://127.0.0.1:8888?userphone='+$("#userphone").attr("name"));
socket.on('connect', () => {
	layer.msg('已成功连接到服务器',{icon: 1});
})
socket.on('server_event', data => {
	if($("#currentObject").html().trim()!=''){
		if(data.isme==1){
			$("#chatMessage").append('<span style="color: #3CB371">'+data.author+'  '+data.date+'</span><br>');
		} else {
			$("#chatMessage").append('<span style="color: #0000FF">'+data.author+'  '+data.date+'</span><br>');
		}
		$("#chatMessage").append('&emsp;'+data.msg+'<br>');
	}
	$("#endMessage").html(data.msg);
});
socket.on('disconnect', () => {
	layer.msg('该账户已下线',{icon: 2});
})
function sendMessageNoParameter(){
	if(sname===''){
		return null;
	}
	var sendContent = layedit.getContent(editIndex)+'';
	let params = {};
    params.msg = sendContent;
    params.fname = $("#userphone").attr("name")+'';
    params.sname = sname;
    editIndex = layedit.build('eQuestionContentEdt', {tool: ['face'],height: 106});
    $.ajax( {
	        url : '/chatroom/send', 
	        type : 'post',
	        data: params,
	        dataType : 'json',
	});
}
layui.use('element', function(){
  var element = layui.element;
});
</script>
</html>
